package com.learning.javaweb_springboot_page_query.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.learning.javaweb_springboot_page_query.entity.Employee;
import com.learning.javaweb_springboot_page_query.mapper.EmployeeMapper;
import com.learning.javaweb_springboot_page_query.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    EmployeeMapper employeeMapper;

    //分页查询（所有员工），当前是查询第一页，数据大小为3个
    public List<Employee> getAllEmployee() {
        IPage<Employee> page = new Page<>();
        page.setCurrent(1);
        page.setSize(3);
        return employeeMapper.selectPageVo(page);
    }
}
